<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">

	<ui:define name="body">

		<h:form id="articuloSearch" styleClass="edit">

			<rich:simpleTogglePanel label="Filtros de Busqueda" switchType="ajax">

				<s:decorate template="layout/display.xhtml">
					<ui:define name="label">Codigo</ui:define>
					<h:inputText id="descripcion"
						value="#{articuloList.articulo.codigoArticulo}" />
				</s:decorate>

			</rich:simpleTogglePanel>

			<div class="actionButtons"><h:commandButton id="search"
				value="Buscar" action="/ListaDePrecios.xhtml" /> <s:button id="reset"
				value="Limpiar Busqueda" includePageParams="false" /></div>

		</h:form>

		<rich:panel>
			<f:facet name="header">Resultados</f:facet>
			<div class="results" id="articuloList"><h:outputText
				value="No hay articulos que coincidan con la busqueda"
				rendered="#{empty articuloList.resultListParaListaDePrecios}" /> <rich:dataTable
				onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
				onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
				id="articuloList" var="_articulo" value="#{articuloList.resultListParaListaDePrecios}"
				rendered="#{not empty articuloList.resultListParaListaDePrecios}">

				<h:column>
					<f:facet name="header">
						<ui:include src="layout/sort.xhtml">
							<ui:param name="entityList" value="#{articuloList}" />
							<ui:param name="propertyLabel" value="Codigo articulo" />
							<ui:param name="propertyPath" value="articulo.codigoArticulo" />
						</ui:include>
					</f:facet>
					<h:outputText value="#{_articulo.codigoArticulo}" />
				</h:column>
				<h:column>
					<f:facet name="header">
						<ui:include src="layout/sort.xhtml">
							<ui:param name="entityList" value="#{articuloList}" />
							<ui:param name="propertyLabel" value="Descripcion" />
							<ui:param name="propertyPath" value="articulo.descripcion" />
						</ui:include>
					</f:facet>
					<h:outputText value="#{_articulo.descripcion}" />
				</h:column>

				<h:column>
					<f:facet name="header">
						<ui:include src="layout/sort.xhtml">
							<ui:param name="entityList" value="#{articuloList}" />
							<ui:param name="propertyLabel" value="Tipo de articulo" />
							<ui:param name="propertyPath" value="articulo.tipoArticulo" />
						</ui:include>
					</f:facet>
					<h:outputText value="#{_articulo.tipoArticulo}" />
				</h:column>
				<h:column>
					<f:facet name="header">
						<ui:include src="layout/sort.xhtml">
							<ui:param name="entityList" value="#{articuloList}" />
							<ui:param name="propertyLabel" value="Precio de Venta" />
							<ui:param name="propertyPath" value="articulo.precioDeVenta" />
						</ui:include>
					</f:facet>
					<h:outputText value="$ #{compraHome.obtenerUltimoPrecioDeVentaParaArticulo(_articulo)}" />
				</h:column>
			</rich:dataTable></div>
		</rich:panel>

		<div class="tableControl"><s:link view="/ArticuloList.xhtml"
			rendered="#{articuloList.previousExists}"
			value="#{messages.left}#{messages.left} Primera pagina"
			id="firstPage">
			<f:param name="firstResult" value="0" />
		</s:link> <s:link view="/ArticuloList.xhtml"
			rendered="#{articuloList.previousExists}"
			value="#{messages.left} Pagina anterior" id="previousPage">
			<f:param name="firstResult"
				value="#{articuloList.previousFirstResult}" />
		</s:link> <s:link view="/ArticuloList.xhtml"
			rendered="#{articuloList.nextExists}"
			value="Pagina siguiente #{messages.right}" id="nextPage">
			<f:param name="firstResult" value="#{articuloList.nextFirstResult}" />
		</s:link> <s:link view="/ArticuloList.xhtml"
			rendered="#{articuloList.nextExists}"
			value="Ultima pagina #{messages.right}#{messages.right}"
			id="lastPage">
			<f:param name="firstResult" value="#{articuloList.lastFirstResult}" />
		</s:link></div>

	</ui:define>

</ui:composition>
